<script setup lang="ts">
import { ref }from'vue';
import { onLoad }from'@dcloudio/uni-app';
import { getSeckillPromotionApi } from '@/apis/seckill';
import type { Promotion } from "@/types/Promotion"

const promotionData = ref<Promotion[]>();

const getSeckillPromotion = async() => {
    const res = await getSeckillPromotionApi();
    promotionData.value = res.data;
}

onLoad(() => {
    getSeckillPromotion()
})
</script>

<template>
    <scroll-view scroll-y class="viewport">
        <navigator class="navigator" v-for="item in promotionData" :url="`/pagesSeckill/seckillGoods/seckillGoods?promotionId=${item.id}`">
            <view class="icon">
                <image src="@/static/images/seckill.png"></image>
            </view>
            <view style="margin-left: 6px;">
                <view style="font-size: 36rpx;">{{ item.title }}</view>
            </view>
        </navigator>
    </scroll-view>
</template>

<style lang="scss">
.viewport {
  background-color: #f4f4f4;
  height:100vh;
  padding: 10px 10px 0 10px;
}

.icon{
  height: 90rpx;
  width: 90rpx;
  }

.navigator{
  height: 150rpx;
  width: 100%;
  background: #ffffff;
  display: flex;
  align-items: center;
  padding: 20rpx 20rpx;
  margin-bottom: 20rpx;
  border-bottom:1px solid rgba(220, 220, 220, 0.521) ;
  border-radius: 14px;
  
}
</style>